package com.yami.shop.seckill.common.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.seckill.common.model.SeckillOrder;
import org.apache.ibatis.annotations.Param;

/**
 * 秒杀订单
 *
 * @author LGH
 * @date 2019-08-28 09:36:59
 */
public interface SeckillOrderMapper extends BaseMapper<SeckillOrder> {

    /**
     * 修改状态
     * @param orderNumber
     * @param state
     */
    void updateStateByOrderNumber(@Param("orderNumber") String orderNumber, @Param("state") int state);

    /**
     * 取消未支付
     * @param orderNumber
     */
    void cancelUnpayOrderByOrderNumber(@Param("orderNumber") String orderNumber);

    /**
     * 取消未支付订单
     */
    void cancelUnpayOrder();

    /**
     * 获取用户秒杀订单数量
     * @param seckillId
     * @param prodId
     * @param userId
     * @return
     */
    int selectNumByUser(@Param("seckillId") Long seckillId, @Param("prodId") Long prodId, @Param("userId") String userId);
}
